package cn.gy.gift.controller;

import cn.gy.gift.service.IVerifyCodeService;
import cn.gy.gift.util.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@RestController
@RequestMapping("/verifycode")
@Api(tags = "验证接口")
public class VerifyCodeController {

    @Autowired
    private IVerifyCodeService verifyCodeService;

    @GetMapping("/imageCode/{key}")
    @ApiOperation("图片验证码")
    public AjaxResult getImgCode(@PathVariable String key){
        return verifyCodeService.getImgCode(key);
    }


    @PostMapping("/sendSmsCode")
    @ApiOperation("获取短信验证码")
    public AjaxResult sendSms(@RequestBody Map<String,String> params){
        return verifyCodeService.sendSms(params);
    }


    @PostMapping("/smsbind")
    @ApiOperation("微信登录绑定手机号时获取验证码")
    public AjaxResult bindSms(@RequestBody Map<String ,String> params){
        return verifyCodeService.bindSms(params);
    }
}
